import { Encrypt,Decrypt} from "@/utils/CryptoJS";
const KEY = 'AUTO_TOKEN_KEY' 
const store = localStorage
/**
 * 保存localStorage中的token
 * @param {*} token 
 */
export const saveAutoToken = token =>{
   token = Encrypt(token)
   store.setItem(KEY,token)
   console.log(token,'加密');
}
/**
 * 获取localStorage中的token
 */
export const getAutoToken = () =>{
  let token = store.getItem(KEY) 
  if (token) {
   return  Decrypt(token)
  }
   return token
    
}
/**
 * 移除localStorage中的token
 */
export const removeAutoToken = () =>{
  store.removeItem(KEY)
}